﻿@*
    // Copyright (c) Alex Reich.
    // Licensed under the CC BY 4.0 License.
*@
@inherits LayoutComponentBase

<div class="page">
    <div class="@NavMenuCssClass" @onclick="ToggleNavMenu">
        <NavMenu />
    </div>
    <div class="main">
        <div class="top-row navbar navbar-light bg-light">
            <div class="container-fluid">
                <button class="navbar-toggler" hidden="@(!collapseNavMenu)" @onclick="ToggleNavMenu">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <a class="navbar-brand" href="">Rules Engine Editor</a>
                <div class="float-right">
                    <a href="/demo">Demo (sample data)</a>
                    &nbsp;
                    <a href="https://github.com/alexreich/RulesEngineEditor" target="_blank">About</a>
                </div>
            </div>
        </div>
        <div class="content px-4">
            @Body
        </div>
    </div>
</div>

@code {
    private bool collapseNavMenu = false;

    private string NavMenuCssClass => collapseNavMenu ? "collapse" : "sidebar";

    private void ToggleNavMenu()
    {
        collapseNavMenu = !collapseNavMenu;
    }
}